package com.liu.text;

import com.liu.proxyDemo.Dog;
import com.liu.proxyDemo.Person;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Text {


    public static void main(String[] ages){
     /*   ApplicationContext applicationContext = new ClassPathXmlApplicationContext("PersonBean.xml");
        Person person = applicationContext.getBean("person",Person.class);
        person.getCat().shut();
        person.getDog().shut();*/
        /* 注解模式   加  @Autowired */

        ApplicationContext applicationContext2 = new ClassPathXmlApplicationContext("AutoPerson.xml");
        Person person2 = applicationContext2.getBean("person",Person.class);
        Dog god = applicationContext2.getBean("dog",Dog.class);
        System.out.println(god.name);

        person2.getCat().shut();
        person2.getDog().shut();


    }
}
